package ganga.ui;

import ganga.sport.R;
import ganga.custodian.CustodianApplication;
import ganga.events.NotificationID;
import ganga.sport.SportsmanMainActivity;
import ganga.sportsman.Application;

import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Intent;
import android.content.Context;

/**
 * Show current info in status area.
 * @author Apocrypha
 * @version 1.3
 * @updated 10-май-2013 20:23:47
 */
public class StatusDisplay {

	public class StatusDisplayItem {
		String Value;
		String Detailed;
	}

	Context context;
	NotificationManager notificationManager;
	private Application application;

	public StatusDisplay(Context context){
		this.context = context;
		notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
	}


	/**
	 * Формирование уведомления и его отображение в строке состояния.
	 * 
	 * @param ticket The ticker text will scroll along the status bar when the Notification is fired.
	 * @param title
	 * @param content
	 */
	public void show(CharSequence ticket, CharSequence title, CharSequence content, NotificationID notifyID) {

		Notification notification = new Notification(R.drawable.globallogo, ticket,
				System.currentTimeMillis());
		notification.flags |= Notification.FLAG_ONGOING_EVENT;

		// The PendingIntent will launch activity if the user selects this
		// notification
		Intent notificationIntent = new Intent();
		notificationIntent.setClass(context, SportsmanMainActivity.class);
		PendingIntent contentIntent = PendingIntent.getActivity(context, 0, notificationIntent, 0);
		notification.setLatestEventInfo(context, "Sportsman", content, contentIntent);

		notificationManager.notify(notifyID.ordinal(), notification);

	}

	public void stopWatchOff(){
		show("Cекундомер остановлен", "", "content", NotificationID.CHRONOMETER_OFF);
	}

	public void show(){

	}

	public void hide(){
		notificationManager.cancelAll();
		notificationManager = null;
	}

	/**
	 * 
	 * @param item
	 */
	public void addItem(StatusDisplayItem item){

	}

	public void removeItem(){

	}
}